#include<iostream>
#include<vector>

using namespace std;

vector<vector<int>> subsets(vector<int>& nums) {
    vector<vector<int>> res;
    vector<int> cur;
    int n = nums.size();
    auto dfs = [&](auto&& dfs, int u) {
        if (u == n)
        {
            res.push_back(cur);
            return;
        }

        dfs(dfs, u + 1);
        cur.push_back(nums[u]);
        dfs(dfs, u + 1);
        cur.pop_back();
        };

    dfs(dfs, 0);
    return res;
}